package jmu.edu.yjc.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jmu.edu.yjc.interfaces.AddGroup;
import jmu.edu.yjc.interfaces.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.math3.analysis.function.Add;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * 用户表(User)表实体类
 *
 * @author makejava
 * @since 2022-10-02 15:38:26
 */
@SuppressWarnings("serial")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_user")
@ApiModel(value = "用户实体")
public class User {
    //主键
    @ApiModelProperty(notes = "主键")
    private Long id;
    private String province;
    private String city;
    private String perSign;
    //用户名
    @ApiModelProperty(notes = "用户名")
    @NotBlank(message = "用户名不能为空,且不包含空格" ,groups = {AddGroup.class})
    private String userName;
    //昵称
    @ApiModelProperty(notes = "昵称")
    @NotNull(message = "昵称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String nickName;
    //密码
    @ApiModelProperty(notes = "密码")
    @NotBlank(message = "密码不能为空",groups = {AddGroup.class})
    private String password;
    //用户类型：0代表普通用户，1代表管理员
    @ApiModelProperty(notes = "用户类型：0代表普通用户，1代表管理员")
    private String type;
    //账号状态（0正常 1停用）
    @ApiModelProperty(notes = "账号状态（0正常 1停用）")
    private String status;
    //邮箱
    @ApiModelProperty(notes = "邮箱")
    @Email(groups = {AddGroup.class, UpdateGroup.class})
    private String email;
    //手机号
    @ApiModelProperty(notes = "手机号")
    @Pattern(regexp = "^1[3-9]\\d{9}$",message = "手机号格式错误",groups = {AddGroup.class, UpdateGroup.class})
    private String phonenumber;
    //用户性别（0男，1女，2未知）
    @ApiModelProperty(notes = "用户性别（0男，1女，2未知）")
    private String sex;
    //头像
    @ApiModelProperty(notes = "头像url")
    private String avatar;
    //创建人的用户id
    @ApiModelProperty(notes = "创建人的用户id")
    @TableField(fill = FieldFill.INSERT)
    private Long createBy;
    //创建时间
    @ApiModelProperty(notes = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    //更新人
    @ApiModelProperty(notes = "更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateBy;
    //更新时间
    @ApiModelProperty(notes = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    //删除标志（0代表未删除，1代表已删除）
    @ApiModelProperty(notes = "删除标志（0代表未删除，1代表已删除）")
    private Integer delFlag;

    }

